USE [CIK_News]
GO
/****** Object:  Table [dbo].[User]    Script Date: 06/15/2012 17:54:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[User](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [varchar](50) NOT NULL,
	[DisplayName] [nvarchar](200) NOT NULL,
	[Password] [varchar](200) NOT NULL,
	[Role] [int] NOT NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[User] ON
INSERT [dbo].[User] ([Id], [UserName], [DisplayName], [Password], [Role]) VALUES (1, N'thangchung', N'Thang Chung', N'123456', 3)
SET IDENTITY_INSERT [dbo].[User] OFF
/****** Object:  Table [dbo].[TrackingInformation]    Script Date: 06/15/2012 17:54:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TrackingInformation](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedDate] [datetime] NULL,
	[User_Id] [int] NOT NULL,
 CONSTRAINT [PK_TrackingInformation] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[TrackingInformation] ON
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (2, CAST(0x0000A06F01357FA2 AS DateTime), CAST(0x0000A06F01357FA3 AS DateTime), 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (5, CAST(0x0000A06F0137B35E AS DateTime), CAST(0x0000A06F0137B35E AS DateTime), 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (8, CAST(0x0000A06F013857CE AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (9, CAST(0x0000A07000F66CAA AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (10, CAST(0x0000A07000FFB831 AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (11, CAST(0x0000A07001006781 AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (12, CAST(0x0000A0700100A5DD AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (13, CAST(0x0000A0700102BDCC AS DateTime), NULL, 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (14, CAST(0x0000A06800000000 AS DateTime), CAST(0x0000A07100C19E84 AS DateTime), 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (15, CAST(0x0000A06700000000 AS DateTime), CAST(0x0000A07100FC6CEC AS DateTime), 1)
INSERT [dbo].[TrackingInformation] ([Id], [CreatedDate], [ModifiedDate], [User_Id]) VALUES (16, CAST(0x0000A06600000000 AS DateTime), CAST(0x0000A07100FC7BF8 AS DateTime), 1)
SET IDENTITY_INSERT [dbo].[TrackingInformation] OFF
/****** Object:  Table [dbo].[Category]    Script Date: 06/15/2012 17:54:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Category](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[TrackingInformation_Id] [int] NOT NULL,
 CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Category] ON
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (1, N'Test cat 01', 2)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (2, N'Test cat 02', 5)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (3, N'Test cat 03', 8)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (4, N'Test cat 04', 9)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (5, N'Test cat 05', 10)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (6, N'Test cat 06', 11)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (7, N'Test cat 07', 12)
INSERT [dbo].[Category] ([Id], [Name], [TrackingInformation_Id]) VALUES (8, N'Test cat 08', 13)
SET IDENTITY_INSERT [dbo].[Category] OFF
/****** Object:  Table [dbo].[ItemContent]    Script Date: 06/15/2012 17:54:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ItemContent](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](500) NOT NULL,
	[SortDescription] [text] NOT NULL,
	[Content] [text] NOT NULL,
	[SmallImage] [varchar](200) NOT NULL,
	[MediumImage] [varchar](200) NOT NULL,
	[BigImage] [varchar](200) NOT NULL,
	[TrackingInformation_Id] [int] NOT NULL,
	[NumOfView] [bigint] NULL,
 CONSTRAINT [PK_ItemContent] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[ItemContent] ON
INSERT [dbo].[ItemContent] ([Id], [Title], [SortDescription], [Content], [SmallImage], [MediumImage], [BigImage], [TrackingInformation_Id], [NumOfView]) VALUES (1, N'This is just demo news', N'Police in the restive Indonesian province of Papua shoot dead separatist leader Mako Tabuni, sparking violent protests by locals.', N'<p>Police in the restive Indonesian province of Papua shoot dead separatist leader Mako Tabuni, sparking violent protests by locals.</p>', N'news-image-small-1.jpg', N'news-image-med-1.jpg', N'news-image-big.jpg', 14, 4)
INSERT [dbo].[ItemContent] ([Id], [Title], [SortDescription], [Content], [SmallImage], [MediumImage], [BigImage], [TrackingInformation_Id], [NumOfView]) VALUES (2, N'Article title', N'Integer diam elit, condimentum ac semper ut, tincidunt non diam. Ut congue rutrum justo at commodo. Aenean euismod tincidunt lorem scelerisque euismod.', N'Integer diam elit, condimentum ac semper ut, tincidunt non diam. Ut congue rutrum justo at commodo. Aenean euismod tincidunt lorem scelerisque euismod.', N'news-image-small-1.jpg', N'news-image-med-2.jpg', N'news-image-big.jpg', 15, 30)
INSERT [dbo].[ItemContent] ([Id], [Title], [SortDescription], [Content], [SmallImage], [MediumImage], [BigImage], [TrackingInformation_Id], [NumOfView]) VALUES (3, N'Second Article Title', N'Sed congue lacinia leo, sed dignissim odio pharetra vel. Fusce a dignissim dui. Fusce semper porttitor enim dapibus venenatis.', N'Sed congue lacinia leo, sed dignissim odio pharetra vel. Fusce a dignissim dui. Fusce semper porttitor enim dapibus venenatis.', N'news-image-small-2.jpg', N'news-image-med-3.jpg', N'news-image-big.jpg', 16, 20)
SET IDENTITY_INSERT [dbo].[ItemContent] OFF
/****** Object:  Table [dbo].[Item]    Script Date: 06/15/2012 17:54:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Item](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Category_Id] [int] NOT NULL,
	[TrackingInformation_Id] [int] NOT NULL,
	[ItemContentId] [int] NULL,
 CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Item] ON
INSERT [dbo].[Item] ([Id], [Category_Id], [TrackingInformation_Id], [ItemContentId]) VALUES (1, 1, 14, 1)
INSERT [dbo].[Item] ([Id], [Category_Id], [TrackingInformation_Id], [ItemContentId]) VALUES (2, 1, 15, 2)
INSERT [dbo].[Item] ([Id], [Category_Id], [TrackingInformation_Id], [ItemContentId]) VALUES (5, 1, 16, 3)
SET IDENTITY_INSERT [dbo].[Item] OFF
/****** Object:  Default [DF_TrackingInformation_ModifiedDate]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[TrackingInformation] ADD  CONSTRAINT [DF_TrackingInformation_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
GO
/****** Object:  ForeignKey [FK_Category_TrackingInformation]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[Category]  WITH CHECK ADD  CONSTRAINT [FK_Category_TrackingInformation] FOREIGN KEY([TrackingInformation_Id])
REFERENCES [dbo].[TrackingInformation] ([Id])
GO
ALTER TABLE [dbo].[Category] CHECK CONSTRAINT [FK_Category_TrackingInformation]
GO
/****** Object:  ForeignKey [FK_Item_Category]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[Item]  WITH CHECK ADD  CONSTRAINT [FK_Item_Category] FOREIGN KEY([Category_Id])
REFERENCES [dbo].[Category] ([Id])
GO
ALTER TABLE [dbo].[Item] CHECK CONSTRAINT [FK_Item_Category]
GO
/****** Object:  ForeignKey [FK_Item_ItemContent]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[Item]  WITH CHECK ADD  CONSTRAINT [FK_Item_ItemContent] FOREIGN KEY([ItemContentId])
REFERENCES [dbo].[ItemContent] ([Id])
GO
ALTER TABLE [dbo].[Item] CHECK CONSTRAINT [FK_Item_ItemContent]
GO
/****** Object:  ForeignKey [FK_Item_TrackingInformation]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[Item]  WITH CHECK ADD  CONSTRAINT [FK_Item_TrackingInformation] FOREIGN KEY([TrackingInformation_Id])
REFERENCES [dbo].[TrackingInformation] ([Id])
GO
ALTER TABLE [dbo].[Item] CHECK CONSTRAINT [FK_Item_TrackingInformation]
GO
/****** Object:  ForeignKey [FK_ItemContent_TrackingInformation]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[ItemContent]  WITH CHECK ADD  CONSTRAINT [FK_ItemContent_TrackingInformation] FOREIGN KEY([TrackingInformation_Id])
REFERENCES [dbo].[TrackingInformation] ([Id])
GO
ALTER TABLE [dbo].[ItemContent] CHECK CONSTRAINT [FK_ItemContent_TrackingInformation]
GO
/****** Object:  ForeignKey [FK_TrackingInformation_User]    Script Date: 06/15/2012 17:54:17 ******/
ALTER TABLE [dbo].[TrackingInformation]  WITH CHECK ADD  CONSTRAINT [FK_TrackingInformation_User] FOREIGN KEY([User_Id])
REFERENCES [dbo].[User] ([Id])
GO
ALTER TABLE [dbo].[TrackingInformation] CHECK CONSTRAINT [FK_TrackingInformation_User]
GO
